package com.HasSet;

import java.util.HashSet;

public class MyHasSetDemo01 {
    public static void main(String[] args) {
      //Ø  定义一个存储Student类型的HashSet集合
        HashSet<Student> hs=new HashSet<>();
        //Ø  创建以下三个Student对象
        //张三,男,20   李四,女,21   张三,男,20
        Student s1 = new Student("张三","男",20);
        Student s2 = new Student("李四","女",21);
        Student s3 = new Student("张三","男",20);
        //Ø  将上述三个对象存储到Set集合中
       hs.add(s1);
       hs.add(s2);
       hs.add(s3);
        //Ø  使用增强for遍历集合，获取每个Student对象，并打印属性值；
        for (Student h : hs) {
            System.out.println(h);
        }
    }
}
